package demoMod.invincibleOne.cards.invincible;

import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
import com.megacrit.cardcrawl.actions.common.GainBlockAction;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.powers.MetallicizePower;
import demoMod.invincibleOne.InvincibleOneMod;

public class Flawless extends AbstractInvincibleCard {
    public static final String ID = InvincibleOneMod.makeID("Flawless");

    private static final CardStrings cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
    public static final String NAME = cardStrings.NAME;
    public static final String DESCRIPTION = cardStrings.DESCRIPTION;
    public static final String IMG_PATH = "cards/Flawless.png";

    private static final CardType TYPE = CardType.SKILL;
    private static final CardRarity RARITY = CardRarity.BASIC;
    private static final CardTarget TARGET = CardTarget.SELF;

    private static final int COST = 1;

    public Flawless() {
        super(ID, NAME, InvincibleOneMod.getResourcePath(IMG_PATH), COST, DESCRIPTION, TYPE, RARITY, TARGET);
        this.baseBlock = InvincibleOneMod.seriousLevel[CardCrawlGame.saveSlot] >= 9 ? 30 : 25;
        this.baseMagicNumber = this.magicNumber = InvincibleOneMod.seriousLevel[CardCrawlGame.saveSlot] >= 9 ? 8 : 5;
    }

    @Override
    public Runnable getUpgradeAction() {
        return () -> {
            this.rawDescription = cardStrings.UPGRADE_DESCRIPTION;
            this.initializeDescription();
        };
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        addToBot(new GainBlockAction(p, p, this.block));
        if (this.upgraded) {
            addToBot(new ApplyPowerAction(p, p, new MetallicizePower(p, this.magicNumber)));
        }
    }
}
